package com.zzy.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzy.system.domain.DetectReportSpusBatch;
import com.zzy.system.mapper.DetectReportSpusBatchMapper;
import com.zzy.system.service.IDetectReportSpusBatchService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DetectReportSpusBatchServiceImpl extends ServiceImpl<DetectReportSpusBatchMapper, DetectReportSpusBatch> implements IDetectReportSpusBatchService {

    private static final Logger log = LoggerFactory.getLogger(DetectReportSpusBatchServiceImpl.class);

    public void saveReportSpusBatchList(List<DetectReportSpusBatch> detectReportSpusBatchs) {
        if(detectReportSpusBatchs != null && !detectReportSpusBatchs.isEmpty()){
            QueryWrapper<DetectReportSpusBatch> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("detail_id", detectReportSpusBatchs.get(0).getDetailId());
            this.baseMapper.delete(queryWrapper);
            this.saveBatch(detectReportSpusBatchs);
        }

    }
}